<template>
	<div class="sendMsg flex-center">
		<s-simulation-search-input 
			v-model="msg" 
			:placeholder="placeholder"
			:isfocus="sendingMsg"
			@blur="handleBlur"
			@focus="handleFocus">
		</s-simulation-search-input>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				placeholder: "点击发送消息",
				msg: "" //需要发送的消息
			};
		},
		methods: {
			handleFocus() {
				this.placeholder = "发送消息...";
			},
			handleBlur() {
				if ( this.msg === "" ) {
					this.placeholder = "点击发送消息";					
				}
			}
		},
		computed: {
			sendingMsg() {
				return this.$store.state.sendingMsg;
			}
		},
		watch: {
			sendingMsg() {
				console.log(11)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.sendMsg {
		width: 20rem;
		height: 3rem;
		background: rgba(255,255,255, .9);
		.similation-search-input {
			border-radius: 0;
		}
	}

</style>